<script setup lang='ts'>
  import { computed, inject } from 'vue';
  import { getAssetsFile } from '@/utils/public';
  // import { addlimit, reducelimit } from '@/hook/imgload';

  const props = defineProps({
    src:{
      type:String,
      default:''
    },
  })
  const imgurl = computed(()=>{
    const { src } = props
    const seg = '/assets/images/'
    if(src.indexOf(seg)>-1) {
      const imgName = props.src.split(seg)[1]
      return getAssetsFile(imgName)
    }else if (src.indexOf('http') == -1 && src.indexOf('https') == -1) {
      return getAssetsFile(src)
    }
    return props.src
  })
  // const FunName = inject('onLoadFunName') as string
  // addlimit(FunName)
  // const Load = ()=>{
  //   reducelimit(FunName)
  // }
  // const error = ()=>{
  //   reducelimit(FunName)
  // }
</script>

<template>
  <img :src="imgurl" >
</template>